//
//  HWXihaolibaoTableViewCell.m
//  HWanGame
//
//  Created by 陈道斌 on 2020/11/23.
//  Copyright © 2020 Chendaobin. All rights reserved.
//

#import "HWXihaolibaoTableViewCell.h"

@implementation HWXihaolibaoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.sheweizhuBut.backgroundColor =  RGB(255, 182, 10);
    self.sheweizhuBut.layer.cornerRadius =13;
    self.sheweizhuBut.layer.masksToBounds = YES;
    
    
    self.shanchuBut.layer.borderWidth = 1;
    self.shanchuBut.layer.borderColor = RGB(204, 204, 204).CGColor;
    self.shanchuBut.layer.cornerRadius = 13;
    self.shanchuBut.layer.masksToBounds = YES;
    
    [self.sheweizhuBut addTarget:self action:@selector(shezhizhu) forControlEvents:UIControlEventTouchUpInside];
    
    [self.shanchuBut  addTarget:self action:@selector(shanchu) forControlEvents:UIControlEventTouchUpInside];
     
    
  //   self.shezhiweiyuanjiaoView.clipsToBounds =  YES;
    
    self.shezhiweiyuanjiaoView.layer.cornerRadius = 8;
    self.shezhiweiyuanjiaoView.layer.masksToBounds = YES;
    
    
    
    
//    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: self.shezhiweiyuanjiaoView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
//    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
//    maskLayer.frame =  self.shezhiweiyuanjiaoView.bounds;
//    maskLayer.path = maskPath.CGPath;
//    self.shezhiweiyuanjiaoView.layer.mask = maskLayer;
    
    
    self.shangbuianView  = [[UIView alloc] initWithFrame:CGRectMake(20, 0,kScreenW-40 , 10)];
    self.shangbuianView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview: self.shangbuianView];
    
    
    self.xiabianView  = [[UIView alloc] initWithFrame:CGRectMake(20, 55,kScreenW-40 , 10)];
    self.xiabianView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview: self.xiabianView];
    
    
    
    
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)setModel:(HWxiaohaodanyuanModel *)model {
    
    _model = model;
    
    self.xiaohaomingchengLabel.text = [NSString stringWithFormat:@"%@",model.role_name];
    self.quefumingchengLabel.text = [NSString stringWithFormat:@"%@",model.servername];
     
    if ([model.is_login intValue] == 1 ) {
        
         self.kuanduWind.constant = 70;
         self.sheweizhuBut.backgroundColor = RGB(247 , 247, 247);
        [self.sheweizhuBut setTitle:@"主账号" forState:UIControlStateNormal];
        [self.sheweizhuBut setTitleColor:RGB(248, 119, 6) forState:UIControlStateNormal];
        
        
        
    } else {
        
        
        
        self.kuanduWind.constant = 93;
        self.sheweizhuBut.backgroundColor = RGB(255, 182, 10);
        [self.sheweizhuBut setTitle:@"设为主账号" forState:UIControlStateNormal];
        [self.sheweizhuBut setTitleColor:RGB(255 , 255 , 255) forState:UIControlStateNormal];
        
        
    }
    
     
    
     
    
    
     
    
    
}

- (void)shezhizhu {
    
    
    [self.delegate shezhiweizhuzhanghao:self.model];
    
    
}


- (void)shanchu  {
    
    
    
     [self.delegate shangchuxiaohao:self.model];
    
    
    
}
@end
